-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Support passing ref to git-commits-since
#1228
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
bin/git-commits-since
Outdated
| git log --pretty='%an - %s' "$REF..HEAD" | ||
| else | ||
| git log --pretty='%an - %s' --after="@{$SINCE}" | ||
| fi No newline at end of file |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's fix the editorconfig lint
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
|
|
||
| echo "... commits since ${REF:-$SINCE}" >&2 | ||
|
|
||
| if [[ -n "$REF" ]]; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Check if "$REF" exist before using it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You mean the actual ref or the variable itself? IOW do you want me to first verify that git can resolve the ref before I use it with the log command? If so, that was a deliberate decision, because the error from git is quite clear, IOW if invalidtag is used as a tag ref then it's a user error and we should let the command fail explicitly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's fine.
| echo "error: option $1 requires an argument" >&2 | ||
| exit 1 | ||
| fi | ||
| REF="$2" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's report an error if both $SINCE and $REF given
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
This line provides little to no value to the end user since the input is very clear. Additionally, from a maintainer's POV it pretty much just pollutes the expected formatted output regardless of the fact that we can avoid it by redirecting stderr and therefore feels redundant --> drop it. Signed-off-by: Erik Skultety <skultety.erik@gmail.com>
Having pretty formatting does aid human readability, but from a maintainer's POV having a commit reference in the commit list to be able to quickly inspect what a given commit from the list is about is invaluable. Signed-off-by: Erik Skultety <skultety.erik@gmail.com>
The commits-since command only considers dates. It's useful to dump a list of commits based on a ref, i.e. a tag, branch, or even another commit. This patch introduces a new optional '--ref|-r' flag that toggles a ref-specific variant of 'git log'. Docs for the respective module has been updated & regenerated as well. Signed-off-by: Erik Skultety <skultety.erik@gmail.com>
05f00c8 to
6dd789f
Compare
|
I added 2 more stylistic commits since last revision as I was primarily testing the interest and seeking approval for the feature with my original proposal.
I hope it won't be necessary for this PR to be re-adjusted :) |
It's OK. This PR is small so I can simply re-review it :) |
hyperupcall
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
git-commits-since
git-commits-sincegit-commits-since
The commits-since command only considers dates. It's useful to dump a list of commits based on a ref, i.e. a tag, branch, or even another commit. This patch introduces a new optional '--ref|-r' flag that toggles a ref-specific variant of 'git log'.
Docs for the respective module has been updated & regenerated as well.